package org.bjtu.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.bjtu.Global;
import org.bjtu.model.Orggroup;
import org.bjtu.service.GroupManageService;
import org.bjtu.service.RoleManageService;


public class GroupManageAction extends DispatchAction {
	
	public ActionForward createGroup(ActionMapping mapping,ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response){
		System.out.println("create group action");
		String groupName = request.getParameter("groupName");
		System.out.println("group name " + groupName);
		Orggroup group = new Orggroup();
		group.setOrggname(groupName);
		Global.getGroupManageService().saveOrUpdate(group);
//		if(new RoleManageService().createRole(roleName, roleDes))
		return mapping.findForward("list");
//		else
//			return "error";
	}

}
